From 96361ff2a8f37dd3ce7ea188ce4e7b038bb6a5aa Mon Sep 17 00:00:00 2001
From: Nicolas Cavallari <nicolas.cavallari@green-communications.fr>
Date: Mon, 4 Jul 2022 13:49:34 +0200
Subject: [PATCH] build-sys: Add missing libatomic_ops dependencies

Add libatomic_ops dependencies to libraries/modules that showed a
failure on an arch that does not have native atomic operations support.

Not all optional dependencies were tested, so it is possible that
some optional modules are still missing libatomic_ops dependencies.

Signed-off-by: Nicolas Cavallari <nicolas.cavallari@green-communications.fr>
Upstream-status: Submitted [https://gitlab.freedesktop.org/pulseaudio/pulseaudio/-/merge_requests/732]
---
 src/meson.build           |  2 +-
 src/modules/meson.build   |  6 +++---
 src/pulse/meson.build     |  2 +-
 src/pulsecore/meson.build | 10 +++++-----
 4 files changed, 10 insertions(+), 10 deletions(-)

diff --git a/src/meson.build b/src/meson.build
index 96dcec354..9efb561d8 100644
--- a/src/meson.build
+++ b/src/meson.build
@@ -205,7 +205,7 @@ else
       libm_dep, thread_dep, dl_dep, shm_dep, iconv_dep, sndfile_dep, dbus_dep,
       x11_dep, libsystemd_dep, glib_dep.partial_dependency(compile_args: true),
       gtk_dep.partial_dependency(compile_args: true), asyncns_dep, libintl_dep,
-      platform_dep, platform_socket_dep, execinfo_dep,
+      platform_dep, platform_socket_dep, execinfo_dep, libatomic_ops_dep,
     ],
     implicit_include_directories : false)
 
diff --git a/src/modules/meson.build b/src/modules/meson.build
index 1d8004300..1e12569dc 100644
--- a/src/modules/meson.build
+++ b/src/modules/meson.build
@@ -14,7 +14,7 @@ all_modules = [
   [ 'module-cli-protocol-tcp', 'module-protocol-stub.c', [], ['-DUSE_PROTOCOL_CLI', '-DUSE_TCP_SOCKETS'], [], libprotocol_cli ],
   [ 'module-cli-protocol-unix', 'module-protocol-stub.c', [], ['-DUSE_PROTOCOL_CLI', '-DUSE_UNIX_SOCKETS'], [], libprotocol_cli ],
   [ 'module-combine', 'module-combine.c' ],
-  [ 'module-combine-sink', 'module-combine-sink.c' ],
+  [ 'module-combine-sink', 'module-combine-sink.c', [], [], [libatomic_ops_dep] ],
 #  [ 'module-coreaudio-detect', 'macosx/module-coreaudio-detect.c' ],
 #  [ 'module-coreaudio-device', 'macosx/module-coreaudio-device.c' ],
   [ 'module-default-device-restore', 'module-default-device-restore.c', [], [], [], libprotocol_native ],
@@ -73,7 +73,7 @@ endif
 
 if host_machine.system() != 'windows'
   all_modules += [
-    [ 'module-rtp-recv', 'rtp/module-rtp-recv.c', [], [], [], librtp ],
+    [ 'module-rtp-recv', 'rtp/module-rtp-recv.c', [], [], [libatomic_ops_dep], librtp ],
     [ 'module-rtp-send', 'rtp/module-rtp-send.c' , [], [], [], librtp ],
   ]
 endif
@@ -243,7 +243,7 @@ module_echo_cancel_sources = [
 ]
 module_echo_cancel_orc_sources = []
 module_echo_cancel_flags = []
-module_echo_cancel_deps = []
+module_echo_cancel_deps = [libatomic_ops_dep]
 module_echo_cancel_libs = []
 
 if get_option('adrian-aec')
diff --git a/src/pulse/meson.build b/src/pulse/meson.build
index c2128e087..1b82c807c 100644
--- a/src/pulse/meson.build
+++ b/src/pulse/meson.build
@@ -85,7 +85,7 @@ libpulse = shared_library('pulse',
   link_args : [nodelete_link_args, versioning_link_args],
   install : true,
   install_rpath : privlibdir,
-  dependencies : [libm_dep, thread_dep, libpulsecommon_dep, dbus_dep, dl_dep, iconv_dep, libintl_dep, platform_dep, platform_socket_dep],
+  dependencies : [libm_dep, thread_dep, libpulsecommon_dep, dbus_dep, dl_dep, iconv_dep, libintl_dep, platform_dep, platform_socket_dep, libatomic_ops_dep],
   implicit_include_directories : false)
 
 libpulse_dep = declare_dependency(link_with: libpulse)
diff --git a/src/pulsecore/meson.build b/src/pulsecore/meson.build
index b30264b3a..b37fec499 100644
--- a/src/pulsecore/meson.build
+++ b/src/pulsecore/meson.build
@@ -251,7 +251,7 @@ libcli = shared_library('cli',
   c_args : [pa_c_args, server_c_args, database_c_args],
   link_args : [nodelete_link_args],
   include_directories : [configinc, topinc],
-  dependencies : [libpulse_dep, libpulsecommon_dep, libpulsecore_dep],
+  dependencies : [libpulse_dep, libpulsecommon_dep, libpulsecore_dep, libatomic_ops_dep],
   install : true,
   install_rpath : privlibdir,
   install_dir : modlibexecdir,
@@ -268,7 +268,7 @@ libprotocol_cli = shared_library('protocol-cli',
   c_args : [pa_c_args, server_c_args, database_c_args],
   link_args : [nodelete_link_args],
   include_directories : [configinc, topinc],
-  dependencies : [libpulse_dep, libpulsecommon_dep, libpulsecore_dep, libcli_dep],
+  dependencies : [libpulse_dep, libpulsecommon_dep, libpulsecore_dep, libcli_dep, libatomic_ops_dep],
   install : true,
   install_rpath : rpath_dirs,
   install_dir : modlibexecdir,
@@ -280,7 +280,7 @@ libprotocol_http = shared_library('protocol-http',
   c_args : [pa_c_args, server_c_args, database_c_args],
   link_args : [nodelete_link_args],
   include_directories : [configinc, topinc],
-  dependencies : [libpulse_dep, libpulsecommon_dep, libpulsecore_dep],
+  dependencies : [libpulse_dep, libpulsecommon_dep, libpulsecore_dep, libatomic_ops_dep],
   install : true,
   install_rpath : privlibdir,
   install_dir : modlibexecdir,
@@ -292,7 +292,7 @@ libprotocol_native = shared_library('protocol-native',
   c_args : [pa_c_args, server_c_args, database_c_args],
   link_args : [nodelete_link_args],
   include_directories : [configinc, topinc],
-  dependencies : [libpulse_dep, libpulsecommon_dep, libpulsecore_dep, dbus_dep],
+  dependencies : [libpulse_dep, libpulsecommon_dep, libpulsecore_dep, dbus_dep, libatomic_ops_dep],
   install : true,
   install_rpath : privlibdir,
   install_dir : modlibexecdir,
@@ -304,7 +304,7 @@ libprotocol_simple = shared_library('protocol-simple',
   c_args : [pa_c_args, server_c_args, database_c_args],
   link_args : [nodelete_link_args],
   include_directories : [configinc, topinc],
-  dependencies : [libpulse_dep, libpulsecommon_dep, libpulsecore_dep],
+  dependencies : [libpulse_dep, libpulsecommon_dep, libpulsecore_dep, libatomic_ops_dep],
   install : true,
   install_rpath : privlibdir,
   install_dir : modlibexecdir,
-- 
2.36.1

